package com.qinghuan.threads.chapterTwo;

/**
 * @Author: dubao
 * @Date: 2022/5/21 10:28
 * @Description:
 */
public class Test2_11_1 {

    public static class TetForContent {
        static final int LINE_NUM = 1024;
        static final int COLUM_NUM= 1024;

        public static void main(String[] args) {
            long [][] array = new long[LINE_NUM][COLUM_NUM];
            long startTime = System.currentTimeMillis();
            for (int i=0; i<LINE_NUM; ++i) {
                for (int j=0; j<COLUM_NUM; ++j) {
                    array[i][j] = i*2 + j;
                }
            }
            long endTime = System.currentTimeMillis();
            long cacheTime = endTime - startTime;
            System.out.println("cache time:" + cacheTime);
        }
    }

    public static class TetForContent2 {
        static final int LINE_NUM = 1024;
        static final int COLUM_NUM= 1024;

        public static void main(String[] args) {
            long [][] array = new long[LINE_NUM][COLUM_NUM];
            long startTime = System.currentTimeMillis();
            for (int i=0; i<COLUM_NUM; ++i) {
                for (int j=0; j<LINE_NUM; ++j) {
                    array[i][j] = i*2 + j;
                }
            }
            long endTime = System.currentTimeMillis();

            System.out.println("cache time:" + (endTime - startTime));
        }
    }

}
